package leetcode.code1664;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int waysToMakeFair(int[] nums) {
		int len = nums.length;
		int[] os = new int[len + 1];
		int[] es = new int[len + 1];
		for (int i = 1; i <= len; i++) {
			if ((i & 1) == 1) {
				os[i] = os[i - 1] + nums[i - 1];
				es[i] = es[i - 1];
			} else {
				es[i] = es[i - 1] + nums[i - 1];
				os[i] = os[i - 1];
			}
		}
		int ans = 0;
		for (int i = 1; i <= len; i++) {
			if(os[i - 1] + es[len] - es[i] == es[i - 1] + os[len] - os[i]) {
				ans++;
			}
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
